package com.zhangxun.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.zhangxun.domain.HotSearch;
import com.zhangxun.service.HotSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Api("热搜管理接口接口")
@RestController
@RequestMapping("/admin/hotSearch")
public class HotSearchController {

    @Autowired
    private HotSearchService hotSearchService;


    @GetMapping("/page")
    @ApiOperation("分页查询轮播图接口")
    @PreAuthorize("hasAuthority('admin:hotSearch:page')")
    public Page<HotSearch> hotSearchpPage(Page<HotSearch> page,HotSearch hotSearch){
        page = hotSearchService.selectPage(page,hotSearch);

        return page;
    }

    @GetMapping("hotSearchByShopId")
    @ApiOperation("小程序搜索页面显示热搜接口")
    public List<HotSearch> searchList(Integer number){

      List<HotSearch> list = hotSearchService.selectByStatus(number);

      return list;
    }
}
